type Status = {
    value: string;
    label: string;
    color: string;
};

export const DownloadTaskStatusOption: Status[] = [
    {value: 'R', label: 'R-执行中', color: '#409eff'},
    {value: 'C', label: 'C-已取消', color: '#909399'},
    {value: 'S', label: 'S-执行成功', color: '#67c23a'},
    {value: 'D', label: 'D-文件已过期', color: '#909399'},
    {value: 'W', label: 'W-执行成功，但是有警告', color: '#e6a23c'},
    {value: 'A', label: 'A-等待执行', color: '#b3d8ff'},
    {value: 'E', label: 'E-异常终止', color: '#f56c6c'}
]

export function getDownloadTaskStatusColor(taskStatus?: "R" | "C" | "S" | "D" | "W" | "A" | "E") {
    const status = DownloadTaskStatusOption.find(s => s.value === taskStatus);
    return status ? status.color : undefined;
}

export function getDownloadTaskStatusLabel(taskStatus?: "R" | "C" | "S" | "D" | "W" | "A" | "E") {
    const status = DownloadTaskStatusOption.find(s => s.value === taskStatus);
    return status ? status.label : undefined;
}

export interface DownloadTaskQuery extends PageQuery {
    taskId?: string;
    taskStatus?: "R" | "C" | "S" | "D" | "W" | "A" | "E";
    remark?: string;
    operator?: string;
    startTimeBegin?: string;
    startTimeEnd?: string;
}

export interface DownloadTaskForm {
    taskId?: string;
    taskStatus?: "R" | "C" | "S" | "D" | "W" | "A" | "E";
    awaitReason?: string;
    awaitTime?: string;
    startTime?: string;
    endTime?: string;
    taskProgress?: number;
    usingTime?: string;
    remark?: string;
    fileName?: string;
    filePath?: string;
    operator?: string;
    msg?: string;
}